/*
 * This program is free software: you can redistribute it and/or modify it under the terms of the 
 * GNU Affero General Public License as published by the Free Software Foundation, either version 3 
 * of the License, or (at your option) any later version.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3, 
 * the Appropriate Legal Notices must display the following words on all interactive user interfaces: 
 * "Copyright (C) 2005-2011 SplendidCRM Software, Inc. All rights reserved."
 */

var L10n =
{
	  GetList: function(sLIST_NAME)
	{
		var bgPage = chrome.extension.getBackgroundPage();
		return bgPage.SplendidCache.TerminologyList(sLIST_NAME);
	}
	, Term: function(sEntryName)
	{
		try
		{
			var bgPage = chrome.extension.getBackgroundPage();
			if ( bgPage.SplendidCache.Terminology(sEntryName) == null )
				return sEntryName;
			return bgPage.SplendidCache.Terminology(sEntryName);
		}
		catch(e)
		{
			SplendidError.SystemAlert(e, 'L10n.Term');
		}
		return sEntryName;
	}
	, TableColumnName: function(sModule, sDISPLAY_NAME)
	{
		try
		{
			var bgPage = chrome.extension.getBackgroundPage();
			if (  sDISPLAY_NAME == 'ID'              
			   || sDISPLAY_NAME == 'DELETED'         
			   || sDISPLAY_NAME == 'CREATED_BY'      
			   || sDISPLAY_NAME == 'CREATED_BY_ID'   
			   || sDISPLAY_NAME == 'CREATED_BY_NAME' 
			   || sDISPLAY_NAME == 'DATE_ENTERED'    
			   || sDISPLAY_NAME == 'MODIFIED_USER_ID'
			   || sDISPLAY_NAME == 'DATE_MODIFIED'   
			   || sDISPLAY_NAME == 'DATE_MODIFIED_UTC'
			   || sDISPLAY_NAME == 'MODIFIED_BY'     
			   || sDISPLAY_NAME == 'MODIFIED_BY_ID'  
			   || sDISPLAY_NAME == 'MODIFIED_BY_NAME'
			   || sDISPLAY_NAME == 'ASSIGNED_USER_ID'
			   || sDISPLAY_NAME == 'ASSIGNED_TO'     
			   || sDISPLAY_NAME == 'ASSIGNED_TO_NAME'
			   || sDISPLAY_NAME == 'TEAM_ID'         
			   || sDISPLAY_NAME == 'TEAM_NAME'       
			   || sDISPLAY_NAME == 'TEAM_SET_ID'     
			   || sDISPLAY_NAME == 'TEAM_SET_NAME'   
			   || sDISPLAY_NAME == 'TEAM_SET_LIST'   
			   || sDISPLAY_NAME == 'ID_C'            
			   || sDISPLAY_NAME == 'AUDIT_ID'        
			   || sDISPLAY_NAME == 'AUDIT_ACTION'    
			   || sDISPLAY_NAME == 'AUDIT_DATE'      
			   || sDISPLAY_NAME == 'AUDIT_COLUMNS'   
			   || sDISPLAY_NAME == 'AUDIT_TABLE'     
			   || sDISPLAY_NAME == 'AUDIT_TOKEN'     
				)
			{
				if ( bgPage.SplendidCache.Terminology('.LBL_' + sDISPLAY_NAME) != null )
					sDISPLAY_NAME = bgPage.SplendidCache.Terminology('.LBL_' + sDISPLAY_NAME);
			}
			else
			{
				if ( bgPage.SplendidCache.Terminology(sModule + '.LBL_' + sDISPLAY_NAME) != null )
					sDISPLAY_NAME = bgPage.SplendidCache.Terminology(sModule + '.LBL_' + sDISPLAY_NAME);
			}
			return sDISPLAY_NAME;
		}
		catch(e)
		{
			SplendidError.SystemAlert(e, 'L10n.TableColumnName');
		}
		return sEntryName;
	}
};


